#!/bin/bash

# for循环实现
sum=0
for ((i = 1; i <= $1; i++)); do
    sum=$((sum + i))
done
echo "For sum: $sum"

# while循环实现
sum2=0
a=1
while ((a <= $1)); do
    sum2=$((sum2 + a))
    a=$((a + 1))
done
echo "While sum: $sum2"